import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    component: Home,
  },
  {
    path: '/classify',
    name: 'classify',

    component: () =>
      import(/* webpackChunkName: "about" */ '../views/Classify'),
  },
  {
    path: '/my',
    name: 'my',

    component: () => import('../views/My'),
  },
  {
    path: '/order',
    name: 'order',

    component: () => import('../views/Order'),
  },
  //  ---------嵌套路由----------
  {
    path: '/newhome',
    name: 'newhome',

    component: () => import('../pages/Home'),
  },
  {
    path: '/news',
    name: 'news',

    component: () => import('../pages/News'),
  },
  {
    path: '/sport',
    name: 'sport',
    redirect: '/sport/Nhome',
    component: () => import('../pages/Sport'),
    children: [
      { path: 'Nhome', component: () => import('../pages/Second/NewHome') },
      {
        path: 'newInland',
        component: () => import('../pages/Second/NewInland'),
      },
      { path: 'newWorld', component: () => import('../pages/Second/NewWorld') },
    ],
  },
]

const router = new VueRouter({
  routes,
})

export default router
